/* Copyright 2012 Tobias Marschall
 *
 * This file is part of CLEVER.
 *
 * CLEVER is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * CLEVER is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with CLEVER.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <cassert>

#include "Variation.h"

int Variation::getLengthDifference() const {
	switch (type) {
	case Variation::INSERTION:
		return -(int)coord2;
	case Variation::DELETION:
		return ((int)coord2) - ((int)coord1);
	default:
		assert(false);
	}
}

std::ostream& operator<<(std::ostream& os, const Variation& variation) {
	os << variation.getChromosome() << " " << variation.getCoordinate1() << " ";
	switch (variation.getType()) {
	case Variation::INSERTION:
		os << variation.getCoordinate2() << " INS";
		break;
	case Variation::DELETION:
		os << (variation.getCoordinate2()-1) << " DEL";
		break;
	default:
		os << variation.getCoordinate2() << " NONE";
		break;
	}
	return os;
}
